<template>
    <div class="dashboard-container">
        <List v-if="page == 'list'" @changePage="changePage" />
        <Zxjl v-if="page == 'zxjl'" :rowData="jumpRowData" @changePage="changePage" />

        <Add v-if="page == 'add'" :taskEnterpriseInfoList="taskEnterpriseInfoList" @changePage="changePage" />
        <Edit :rowData="detail" v-if="page == 'edit'" @changePage="changePage" />
        <Zbpz  :rowData="taskEnterpriseInfoList" v-if="page == 'zbpz'" @changePage="changePage" />
        <ZbpzEdit :rowData="jumpRowData" v-if="page == 'editzbpz'" @changePage="changePage" />
        <Result :rowData="jumpRowData" v-if="page == 'result'" @changePage="changePage" />
    </div>
</template>

<script>
import List from "./list";
import Zxjl from "./zxjl";
import Add from "./add";
import Edit from "./edit";
import Zbpz from "./configuration";
import ZbpzEdit from "./configurationEdit";
import Result from "./result";
export default {
    name: 'znjk',
    components: {
        List,
        Zxjl,
        Add,
        Edit,
        Zbpz,
        Result,
        ZbpzEdit

    },
    data() {
        return {
            loading: false,
            nsrsbh: '',
            detail: {},
            page: "list",
            taskEnterpriseInfoList: {},
            pztype: '',

            jumpRowData: {}

        }
    },

    mounted() {
    },
    methods: {
        changePage(page, payload, zbtype) {
          
            if (payload && page == "add") {
                this.taskEnterpriseInfoList = payload || "";
            }
            if (payload && page == "zbpz") {
                this.taskEnterpriseInfoList = payload || "";
            }
            if (payload && page == "edit") {
                this.detail = {}
                if (payload.rowData) {
                    console.log(11)
                    this.detail = payload || ""
                } else {
                    this.detail.rowData = payload || ""
                }

            }
            if (payload && page == "editzbpz") {
                this.jumpRowData = payload || ""
            }
            if (payload && page == "zxjl") {
                this.jumpRowData = payload || ""
            }
            if (payload && page == "result") {
                this.jumpRowData = payload || ""
            }
            if (this.page == page) {
                this.page = "";
                this.$nextTick(() => {
                    this.page = page;
                });
            } else {
                this.page = page;
            }

            console.log(this.page)
        },

    }
}
</script>

<style lang="scss" scoped>
.dashboard-container {
    width: 100%;
    min-height: 100%;
    background-color: #fff;
    padding: 8px;
}
</style>
